import React from 'react'
import { useLocation } from 'react-router-dom'
import qs from 'qs'
export default function Music() {
  //通过useLocation 可以拿到查询字符串的值 保存在search上
  const Location = useLocation()
  //console.log(Location,'Location');
  //字符串切割 通过qs.parse()解析为对象并解构出来
  const { user, id } =qs.parse(Location.search.split('?')[1]) ;
  //console.log(qs.parse(Location.search.split('?')[1]));
  
  return (
    <div>
      <p>Music</p>
      <span>您的用户名是:{user} 您的id是:{id}</span>
    </div>
  )
}
